<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.eagle.commons.vo.tbl_PosOperatorDic"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>发票使用查询</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<jsp:include page="../common/easyui.jsp"></jsp:include>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/util.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/print.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/engine.js"></script>
	
	<script type='text/javascript' src="<%=request.getContextPath()%>/dwr/interface/PrintDwr.js"></script>
	 <script type="text/javascript">
	 <% tbl_PosOperatorDic posoper = (tbl_PosOperatorDic)session.getAttribute("posoper");
       	  Integer posID = posoper.getBL_PosID();
       %>
	 //查询该时间内的发票使用
	 $(function(){
	 $('#print').datagrid({
				iconCls:'icon-save',
				height:350,
				pagination:true,
				autoRowHeight: false,
				striped: true,
				collapsible:true,
				rownumbers:true,
				url:'showInfoAction!showPrintWate.action',
				singleSelect:true,
				fitColumns:false,
				frozenColumns:[[
				{field:'userName',title:'用户名称',width:100}
				]],
				columns:[[
					{field:'VLP',title:'车牌号码',width:80},
					{field:'cardID',title:'卡号',width:150},
					{field:'wasteTime_str',title:'业务时间',width:120,sortable:true},
					{field:'printMoney',title:'打印金额',width:70},
					{field:'posName',title:'机构名称',width:100},
					{field:'oper',title:'办理操作员',width:60},
					{field:'invType',title:'票据类型',width:100,
					 formatter: function(value,row,index){
				                      if (row.invType==1){
					                   	return '记账卡月结票据';
			                           } else if(row.invType==2) {
				                        return '储值卡月结票据 ';
			                           }
			              }
					},
					{field:'printTime_str',title:'打印时间',width:120},
					{field:'invID',title:'票据号',width:70,sortable:true},
					{field:'invoiceFlag',title:'打印类型',
					formatter: function(value,row,index){
				                      if (row.invoiceFlag==1){
					                   	return '正常打印';
			                           } else if(row.invoiceFlag==2){
				                        return '重打';
			                           }else if(row.invoiceFlag==3){
				                        return '补打';
			                           }else if(row.invoiceFlag==4){
				                        return '集团用户正常打印';
			                           }else if(row.invoiceFlag==5){
				                        return '集团用户重打';
			                           }else if(row.invoiceFlag==6){
				                        return '集团用户补打';
			                           }
						}
					},
					{field:'beforeInvID',title:'上次打印票据号',width:70},
					{field:'inv',title:'票据批次号',width:70},
					{field:'startTime_str',title:'打印开始时间',width:70},
					{field:'endTime_str',title:'打印结束时间',width:70}
				]]
				});
				
				$("#printMon").datebox({  
		        		required:true,  
		        		onSelect: function(date){  
		        		  var y = date.getFullYear();  
   						  var m = date.getMonth() + 1;  
   						  if(m<10)m="0"+m;
    					  var d = date.getDate();  
		        		 $("#printMon").datebox("setValue", y+"-"+m);
		        		}  
		   			 });  

				
	 });
	 function doSearch(){ 
		 $('#print').datagrid('load',{    
          operID: $('#operID').val(),    
          operType:$('#operType').combobox('getValue'),
          beginTime: $('#beginTime').datebox('getValue'),
          endTime: $('#endTime').datebox('getValue'),
          printMon:$("#printMon").datebox('getText'),
          userName:encodeURI($('#userName').val()),
          VLP:encodeURI($('#VLP').val())
        });    
 	 }  
 	 
 	 function exportInfo(){
 	 var operID=$('#operID').val();
 	 var operType=$('#operType').combobox('getValue');
 	 var beginTime=$('#beginTime').datebox('getValue');
 	 var endTime=$('#endTime').datebox('getValue');
 	 var printMon=$("#printMon").datebox('getText');
 	 var userName=encodeURI(encodeURI($('#userName').val()));
 	 var vlp=encodeURI(encodeURI($('#VLP').val()));
 	 //   document.searchForm.action = "showInfoAction!exportPrintWaste.action";
	//	 document.searchForm.submit();
 	/*  PrintDwr.exportPrintWaste(operID,operType, beginTime,endTime,
				userName, vlp, printMon,function(data){
				if(data!=""){
					alert("导出票据使用明细失败，请检查");
				}
				
				}); */
		window.location.href="showInfoAction!exportPrintWaste.action?"+"operID="+operID+"&operType="+operType+"&beginTime="+beginTime+"&endTime="+endTime+"&userName="+userName+"&VLP="+vlp+"&printMon="+printMon;
		}

 	
	 </script>
	 
  </head>
  
  <body>
   <div id="searchDiv" class="easyui-panel"  title="票据打印——查询条件" style="background-color:#EBF2FF;" collapsible="true">
		<form id="searchForm" method="post" style="margin-top:10px" action="">
	           <table >
	           <tr>
	           		<td width="5%" align="right">
							<div style="font-family:微软雅黑;font-size:12px;">用户名称&nbsp;&nbsp;</div>
						</td>
						<td width="8%" align="left">
							<input  class="easyui-validatebox" data-options="required:true"  type="text"  id="userName" name="userName" style="width:120px;border:1px solid #ccc" />
						</td>
						<td width="5%" align="right">
							<div style="font-family:微软雅黑;font-size:12px;">车牌号码&nbsp;&nbsp;</div>
						</td>
						<td width="8%" align="left">
							<input  class="easyui-validatebox" data-options="required:true"  type="text"  id="VLP" name="VLP" style="width:120px;border:1px solid #ccc" />
						</td>
						<td width="5%" align="right">
							<div style="font-family:微软雅黑;font-size:12px;">账单月份&nbsp;&nbsp;</div>
						</td>
						<td width="8%" align="left">
							<input class="easyui-datebox" data-options="required:true"  type="text"  id="printMon" name="printMon" style="width:120px;border:1px solid #ccc" />
						</td>
	           </tr>
					<tr>
						<td width="5%" align="right">
							<div style="font-family:微软雅黑;font-size:12px;">操作员 编号&nbsp;&nbsp;</div>
						</td>
						<td width="8%" align="left">
							<input  class="easyui-validatebox" data-options="required:true"  type="text"  id="operID" name="operID" style="width:120px;border:1px solid #ccc" />
						</td>
						<td width="5%" align="right">
							<div style="font-family:微软雅黑;font-size:12px;">打印类型&nbsp;&nbsp;</div>
						</td>
						<td width="8%" align="left">
							<!-- <input  class="easyui-validatebox" data-options="required:true" 
							type="text"  id="operType" name="operType" style="width:120px;border:1px solid #ccc" /> -->
							<select id="operType" class="easyui-combobox" name="operType" style="width:120px;border:1px solid #ccc" >  
								<option value="">请选择打印类型</option> 
    							<option value="1">正常打印</option>   
    							<option value="2">重打</option>   
    							<option value="3">补打</option>   
    							<option value="4">集团用户正常打印</option> 
    							<option value="5">集团用户重打</option> 
    							<option value="6">集团用户补打</option> 
							</select> 
						</td>
						<td width="5%" align="right">
							<div style="font-family:微软雅黑;font-size:12px;">打印时间&nbsp;&nbsp;</div>
						</td>
						<td width="8%" align="left">
							<input class="easyui-datebox" data-options="required:true"  type="text"  id="beginTime" name="beginTime" style="width:120px;border:1px solid #ccc" />
						</td>
						<td width="5%" align="right">
							<div style="font-family:微软雅黑;font-size:12px;">至&nbsp;&nbsp;</div>
						</td>
						<td width="8%" align="left">
							<input class="easyui-datebox" data-options="required:true"  type="text"  id="endTime" name="endTime" style="width:120px;border:1px solid #ccc" />
						</td>
					</tr>
					</table>
					<div align="center">
					<table >
					<tr></tr>
					<tr></tr>
					<tr>
						<td colspan="2" width="20%" >
							<table align="center">
								<tr>
									<td width="10%" align="center"> <a href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-search"  onclick="doSearch()">查询</a>
									<a href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-redo" onclick="$('#searchForm')[0].reset();" >重置</a>
                                    </td>   
								</tr>
							</table>
						</td>						
					</tr>
				</table>     
				</div>
		 </form>
	</div>
	 <div id="rs" class="easyui-panel"  title="查询结果" style="background-color:#EBF2FF;" collapsible="true" data-options="tools:'#tt'">
	 <table id="print" style="width:auto;overflow:auto"></table>    
	 </div>
	 <div id="tt">
          <a href="javascript:void(0)" class="icon-edit"  title="导出" onclick="exportInfo();"></a>
      <!--    <a href="javascript:void(0)" class="icon-print"  title="打印" onclick="printInfo()"></a>  -->
       <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-print" plain="true" title="打印" onclick="CreateFormPage('使用明细打印', $('#print'))"></a>
    </div>
    <input id="inv" type="hidden"/>
  </body>
</html>
